Interrupt 21h Function 440Dh Minor Code
71h
Retrieves the
first cluster of the specified file or directory.
mov ax, 440Dh ; generic IOCTL
mov bx, CharSet ; see below
mov ch, 08h ; device category
mov cl, 71h ; Get First Cluster
mov dx, seg PathName ; see below
mov ds, dx
mov dx, offset PathName
int 21h
jc error
Parameters
CharSet
Character set
of PathName. This parameter must be one of these values:
BCS_WANSI
(0) |
Windows
ANSI character set |
BCS_OEM (1) |
Current OEM
character set |
BCS_UNICODE
(2) |
Unicode
character set |
PathName
Address of a
null-terminated string containing the path of the file or directory to retrieve
the first cluster for.
Return Value
Clears the
carry flag and sets DX:AX to the first cluster number if successful. Otherwise,
the function sets the carry flag and returns either the ERROR_INVALID_FUNCTION
or ERROR_ACCESS_DENIED value in AX.
Remarks
The first
cluster of a file is the first cluster of the FAT cluster chain describing the
data associated with the file. The first cluster of a directory is the first
cluster of the FAT cluster chain associated with the directory. It is the
cluster that contains the . and .. entries. The function finds any file or directory
regardless of attribute (system, hidden, or read-only). It does not find volume
labels.
If your
application is unable to accommodate a 32-bit cluster number, you must check to
see if the value returned in the DX register is greater than zero.
if(MAKELONG(regAX,regDX) > 0x0000FFF8)
b32BitNum = TRUE;
else
b32BitNum = FALSE;
It is the
calling application s responsibility to check to see if the returned
cluster number is valid.
if((MAKELONG(regAX,regDX) < 2L) || (MAKELONG(regAX,regDX)
> maxClus))
bInvalidNum = TRUE;
else
bInvalidNum = FALSE;
In the
preceding example, the maxClus variable is the maximum legal cluster
number, as a DWORD type, computed from the drive parameters.